<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript">
        var a=2;
        function fn1()
        {
            var b=3;
            function fn2()
            {
                var c=4;
                console.log(c);
                console.log(b);
                console.log(a);
                console.log(d);
            }
            fn2();
        }
        fn1();
        /*
        输出答案：
        c=4 b=3 a=2 d is not defined
        局部作用域没找到参数就往上一层找
        */
    </script>
</head>
<body>
    <img src="../../IMG/03-03.作用域链.png">
</body>
</html>